package com.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DAOConnector {
	private Connection conn = null;
	
	public Connection getConnection(){
		String url = "jdbc:mysql://localhost:3306/pls";
		String user = "root";
		String password = "password";
		String driver = "com.mysql.jdbc.Driver";
		try {

			// This will load the MySQL driver, each DB has its own driver
			Class.forName(driver);
		
			// Create a connection to the database
			conn = DriverManager.getConnection(url,user,password);
		} catch (ClassNotFoundException e) {
			// Could not find the database driver
			System.out.println("ClassNotFoundException : "+e.getMessage());
		
		} catch (SQLException e) {
		
			// Could not connect to the database
			System.out.println(e.getMessage());
		}
		
	return conn;
	}
		
}
